package com.benmu.wx;

import android.app.Application;
import android.util.Log;

import com.alibaba.sdk.android.BaseAlibabaSDK;
import com.alibaba.sdk.android.callback.InitResultCallback;
import com.benmu.framework.BMWXApplication;
import com.benmu.wx.module.TaobaoModule;
import com.taobao.weex.WXSDKEngine;
import com.taobao.weex.common.WXException;

/**
 * Created by Carry on 2017/8/23.
 */

public class App extends BMWXApplication {
    public Application mInstance;
    private static final String TAG = "com.benmu.wx.App";

    @Override
    public void onCreate() {
        super.onCreate();
        mInstance = this;

        try{
            WXSDKEngine.registerModule("taobao", TaobaoModule.class);
        } catch (WXException e) {
            e.printStackTrace();
        }

        BaseAlibabaSDK.asyncInit(this, new InitResultCallback() {
            @Override
            public void onSuccess() {
                Log.d(TAG,"BaseAlibabaSDK init successed");
            }

            @Override
            public void onFailure(int code, String msg) {
                Log.e(TAG,"BaseAlibabaSDK init failed");
            }
        });

        /*AlibcTradeSDK.asyncInit(this, new AlibcTradeInitCallback(){

            @Override
            public void onSuccess() {
                Log.d(TAG,"AlibcTradeSDK init successed");
                *//*
                 * 设置全局淘客参数，方便开发者用同一个淘客参数，不需要在show接口重复传入
                 * 注意：初始化完成后调用才能生效
                 *
                 * @param taokeParams 淘客参数
                 *//*
                AlibcTaokeParams taokeParams = new AlibcTaokeParams();
                taokeParams.setPid("mm_76464962_44124105_422720854");
                taokeParams.setAdzoneid("422720854");
                taokeParams.setUnionId("yhq");
                AlibcTradeSDK.setTaokeParams(taokeParams);
            }

            @Override
            public void onFailure(int i, String s) {
                Log.e(TAG,"AlibcTradeSDK init failed");
            }
        });*/


    }

}
